import logging,HTMLTestRunner_cn,yagmail

class Tools():
    def send_mail(self):
        mail=yagmail.SMTP(user='3047217905@qq.com',password='wsmqyonwzaxqdcgj',host='smtp.qq.com',port='465')
        mail.send(to='3047217905@qq.com',subject='携程自动化测试请查收',contents=['ctrip.html','ctrip.log'])
        mail.close()

    def report(self):
        report = HTMLTestRunner_cn.HTMLTestRunner(open('ctrip.html', 'wb'),
                                                  title='携程自动化测试',
                                                  description='包含一条登录用例')
        return report

    def Log(self):
        log = logging.basicConfig(level=logging.DEBUG,
                                  format='%(levelname)s-%(asctime)s-%(filename)s-%(message)s-%(lineno)d',
                                  filemode='a+',
                                  filename='ctrip.log')
        return log